<html>
<title>JVM interpreter by JavaScript</title>
<body>
<br>

<script type="text/javascript" src="JS/init.js"></script>
<script type="text/javascript" src="JS/test.js"></script>

<script>test();</script>
<br>

<input type="button" id="runtest" value="test" onclick="test()"/>

<br><br>
<input type="file" id="fileinput"/>
<br><br>
<textarea id="show" name="show" cols="100" rows="20" > </textarea> 
<script type="text/javascript">
  function readSingleFile(evt) {
    //Retrieve the first (and only!) File from the FileList object
    var f = evt.target.files[0]; 

    if (f) {
      var r = new FileReader();
      r.onload = function(e) { 
	      var contents = e.target.result;
        //alert( "Got the file.n" 
        //      +"name: " + f.name + "n"
        //      +"type: " + f.type + "n"
        //      +"size: " + f.size + " bytesn"
        //      + "starts with: " + contents.substr(1, contents.indexOf("n"))
        //);  
	//alert(contents);
	document.getElementById('show').value=contents;
      }
      r.readAsText(f);
      
    } else { 
      alert("Failed to load file");
    }
    return contents;
  }

  document.getElementById('fileinput').addEventListener('change', readSingleFile, false);
</script>
</body>
</html>